<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 输入框默认提示(鼠标经过显示提示，当获得焦点或输入内容时，提示消失) -->
   
    <input type="text"id="id" >
    <script>
        var inDom=document.getElementById("id");
        inDom.onblur=function(){
            if(inDom.value==""){
                inDom.value="请输入内容";
            }
        }
        inDom.onfocus=function(){
            if(inDom.value!=""){
                inDom.value="";
    
            }
        }
    </script>
    </script>
</body>
</html>